const daoCommon=require('../utils/daoCommon');

const dao={
    /**
     * 教师账号密码登录
     * */
    Login:async(data)=>{
        let sql=`select * from teacheruser where TeacherUserAccount=$TeacherUserAccount and TeacherUserPassword=$TeacherUserPassword`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 检查教师手机号是否注册
     * */
    InspectTeacherUserMobile:async(data)=>{
        let sql=`select * from teacheruser where TeacherUserMobile=$TeacherUserMobile`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 教师修改昵称
     * */
    UpdateTeacherUserName:async(data)=>{
        let sql=`update teacheruser set TeacherUserName=$TeacherUserName where TeacherUserId=$TeacherUserId`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 教师手机号修改
     * */
    UpdateTeacherUserMobile:async(data)=>{
        let sql=`update teacheruser set TeacherUserMobile=$TeacherUserMobile where TeacherUserId=$TeacherUserId`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 根据用户id查询密码是否正确
     * */
    PasswordVerification:async(data)=>{
        let sql=`select * from teacheruser where TeacherUserId=$TeacherUserId and TeacherUserPassword=$TeacherUserPassword`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 修改教师密码
     * */
    UpdatePassword:async (data)=>{
        let sql=`update teacheruser set TeacherUserPassword=$TeacherUserPassword where TeacherUserId=$TeacherUserId`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 修改教师头像
     * */
    UpdateTeacherUserAvatar:async (data)=>{
        let sql=`update teacheruser set TeacherUserAvatar=$TeacherUserAvatar where TeacherUserId=$TeacherUserId`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 教师升级条件查询
     * */
    QueryUpgrade:async (data)=>{
        let sql=`select TeacherUserGrade,TeacherUserFans,LectureFrequency,TeacherListenNumber from teacheruser where TeacherUserId=$TeacherUserId`;
        return await daoCommon.oneMethod(sql,data)
    },
    /**
     * 根据用户id查询教师信息
     * */
    QueryTeacherUser:async (data)=>{
        let sql=`select * from teacheruser where TeacherUserId=$TeacherUserId`;
        return await daoCommon.oneMethod(sql,data)
    }
};

module.exports=dao;
